@echo off
echo Starting Into_IoTDB Service...

REM 检查Java环境
java -version >nul 2>&1
if %errorlevel% neq 0 (
    echo Error: Java is not installed or not in PATH
    pause
    exit /b 1
)

REM 检查Maven环境
mvn -version >nul 2>&1
if %errorlevel% neq 0 (
    echo Error: Maven is not installed or not in PATH
    pause
    exit /b 1
)

REM 创建必要的目录
if not exist "uploads" mkdir uploads
if not exist "uploads\chunks" mkdir uploads\chunks
if not exist "logs" mkdir logs

echo Creating necessary directories...

REM 编译项目
echo Compiling project...
mvn clean compile
if %errorlevel% neq 0 (
    echo Error: Compilation failed
    pause
    exit /b 1
)

REM 启动应用
echo Starting application...
mvn spring-boot:run

pause
